package com.sfzd5.exam.helplibrary.exam;

import com.sfzd5.exam.helplibrary.exam.answersheet.*;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 一次考试的信息，应该包含的内容：编号、考试名称、科目、类别、时间
 * 包含的学生信息：学生编号、
 */
public class ExamInof {
    public String taskId;
    public String examName = "答题卡测试题"; //
    public String subject = ""; //学科，每个学科建一个考试
    public List<Area> areaList = new ArrayList<>();
    public List<Page> pages = new ArrayList<>();
    public Timestamp creationTime = Timestamp.valueOf(LocalDateTime.now());

    public ExamInof(){

    }

    @Override
    public String toString() {
        return examName;
    }

    public void cleanAreaList(){
        for(Area area : areaList){
            List<AnswerSheetQuestion> ss = new ArrayList<>();
            for(AnswerSheetQuestion a : area.answerSheetQuestionList){
                if(area.areaType == Area.AreaType.Choice){
                    ss.add(new ChoiceAnswerSheetQuestion(a));
                } else if(area.areaType == Area.AreaType.Blank){
                    ss.add(new BlankAnswerSheetQuestion(a));
                } else if(area.areaType == Area.AreaType.Expound){
                    ss.add(new ExpoundAnswerSheetQuestion(a));
                }
            }
            area.answerSheetQuestionList = ss;
        }
    }
}
